package service.impl;

import dao.UserDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import pojo.User;
import service.UserService;

import javax.annotation.Resource;
import java.util.List;

//交给Spring管理。
@Service
public class UserServiceImpl implements UserService {

    //自动装配。
    @Resource
    private UserDao userDao;

    //事务管理
    @Transactional(isolation = Isolation.REPEATABLE_READ,propagation = Propagation.SUPPORTS)
    @Override
    public List<User> listUsers() {
        return userDao.queryUsers();
    }
}
